package vn.sunnet.backviet01.game.coloa.util;

import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.opengl.texture.region.TextureRegion;

public class MySprite extends Sprite{
	public final float xFinal;
	public final float yFinal;
	
	public float xPos;
	public float yPos;

	private boolean isLock = true;
	private boolean isUnlock = false;
	
	private float pX;
	private float pY;
	
	private final int Z_INDEX;
	
	public MySprite(int zIndex, float pX, float pY, TextureRegion pTextureRegion) {
		super(pX, pY, pTextureRegion);

		this.Z_INDEX = zIndex;
		this.setZIndex(Z_INDEX);
		
		this.xFinal = pX;
		this.yFinal = pY;
		
		this.xPos = pX;
		this.yPos = pY;
		
		this.pX = pX;
		this.pY = pY;
		
	}

	public void resetInfomation() {
		this.isLock = true;
		this.isUnlock = false;
	}
	
	public boolean contains(final float pX, final float pY) {
		if (this.isVisible())
			return super.contains(pX, pY);
		return false;
	}
	
	public boolean isUnlock() {
		return isUnlock;
	}

	public void setUnlock(boolean isUnlock) {
		this.isUnlock = isUnlock;
	}

	public boolean isLock() {
		return isLock;
	}

	public void setLock(boolean isLock) {
		this.isLock = isLock;
	}

	public int getZ_INDEX() {
		return Z_INDEX;
	}

	public float getpX() {
		return pX;
	}

	public void setpX(float pX) {
		this.pX = pX;
	}

	public float getpY() {
		return pY;
	}

	public void setpY(float pY) {
		this.pY = pY;
	}

	public void resetZIndex() {
		this.setZIndex(Z_INDEX);
	}
	
	public void resetPosition() {
		this.setPosition(xFinal, yFinal);
		this.pX = this.xFinal;
		this.pY = this.yFinal;
		this.xPos = this.xFinal;
		this.yPos = this.yFinal;
	}
	
}
